<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/10/3 0003
  Time: 20:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


<html>
<head>
    <title>Title</title>
    <link href="<%=request.getContextPath()%>/css/index.css" rel="stylesheet">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/bootstrap.min.css">
    <link href="<%=request.getContextPath()%>/css/style.css" rel="stylesheet" type="text/css">
    <link rel='stylesheet' href='https://unicons.iconscout.com/release/v2.1.9/css/unicons.css'>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/foot.css" />
    <link href="<%=request.getContextPath()%>/css/index01.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/css/loading.css" rel="stylesheet" type="text/css">


</head>
<body style="background: #eee;">

<%--导航条--%>
<jsp:include page="../common/nav.jsp"></jsp:include>



<div  style="height: 600px;width: 65%;margin: 50px auto;text-align: center;background: white;border-radius: 5px;">
    <div style="padding-top: 30px"><h2 id="paperName">Java测试一</h2></div>
    <div style="margin: 10px auto;">
        <span style="font-weight: bold">分类  :</span>  <span id="language"></span> &nbsp;
        <span style="font-weight: bold">难度  :</span> <span id="diff"></span> &nbsp;
        <span style="font-weight: bold">使用次数  :</span> <span id="count"></span> &nbsp;
    </div>
    <div style="margin: 0 auto ;" >
        <table class="table table-striped text-center" style="width: 50%;margin-left: 25%;margin-top: 20px;border: 2px solid #eee">
            <thead>
            <tr>
                <td>题型</td>
                <td>题量</td>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>单选题</td>
                <td id="sin"></td>
            </tr>
            <tr>
                <td>多选题</td>
                <td id="man"></td>
            </tr>
            <tr>
                <td>简答题</td>
                <td id="com"></td>
            </tr>
            <tr>
                <td >编程题</td>
                <td id="pro"></td>
            </tr>
            </tbody>
        </table>
    </div>
    <div style="padding-top: 50px;"><button id="begin" class="btn-info" onclick="begin()" style="width: 200px;height: 50px;border: none;">
        <%--<a href="'/yuezhi/parper/manchoose?parperId='+${count[4]}"></a> --%>
        开始考试</button></div>
    <div style="height: 150px;width: 80%;margin: 20px auto;">
        <h4 style="line-height: 50px;">试卷说明</h4>
        <div style="line-height: 30px;padding-top: 10px;border-radius: 5px;">
            1.本套试卷来源于网上，由悦知网注册用户提供，除非经特别声明，悦知网不拥有该资料版权，亦不承担任何法律责任。<br>
            2.未经网站或作者的同意不得转载，否则构成侵权，本网站或作者保留诉诸法律的权利。<br>
            3.如发现本网站载有侵犯您著作权的侵权信息，可依法向我们提出权利申请，申请方式点击查看。
        </div>
    </div>
</div>


<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.min.js" ></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/bootstrap.min.js" ></script>

<script>
    var paperList = ${paperList};
    for(var i=0;i<paperList.length;i++){
        console.log(paperList[i])
    }
    var parperId = paperList[0]//ID
    $("#paperName").html(paperList[1]);//名称
    $("#language").html(paperList[2]);//类别
    $("#diff").html(paperList[3]);//难度
    $("#count").html(paperList[4]);//次数

    $("#sin").html(paperList[5]);//单选
    $("#man").html(paperList[6]);//多选
    $("#com").html(paperList[7]);//填空
    $("#pro").html(paperList[8]);//编程

    var score = paperList[5]*5 + paperList[6]*5 + paperList[7]*5 + paperList[8]*20;
    console.log("score"+score);



    //开始考试按钮的事件
    function begin() {


        //将试卷号,和分数传给后端
        $.post("/yuezhi/parper/exaInfo",{
            "parperId":parperId,
            "score":score
        },function (data) {
            if (data == "请先登录"){
                alert("请先登录");
            }
            else if(data == "获取考试编号失败"){
                alert("获取考试编号失败")
            }
            else {
                var testId = data;
                console.log(testId)
                window.location="/yuezhi/parper/choose/"+parperId + "/" +testId;
            }
        })


        //将parperId传给单选题
        <%--var parperId =  ${count[4]};--%>
        //***********************************************
    }

</script>

</body>
</html>
